/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package nxtmodel2.impl;

import nxtmodel2.Nxtmodel2Package;
import nxtmodel2.Rule;
import nxtmodel2.RuleAnnotation;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Rule Annotation</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link nxtmodel2.impl.RuleAnnotationImpl#getRuleParent <em>Rule Parent</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class RuleAnnotationImpl extends NxtNodeImpl implements RuleAnnotation {
	/**
	 * The cached value of the '{@link #getRuleParent() <em>Rule Parent</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getRuleParent()
	 * @generated
	 * @ordered
	 */
	protected Rule ruleParent;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected RuleAnnotationImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Nxtmodel2Package.Literals.RULE_ANNOTATION;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Rule getRuleParent() {
		if (ruleParent != null && ruleParent.eIsProxy()) {
			InternalEObject oldRuleParent = (InternalEObject)ruleParent;
			ruleParent = (Rule)eResolveProxy(oldRuleParent);
			if (ruleParent != oldRuleParent) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT, oldRuleParent, ruleParent));
			}
		}
		return ruleParent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Rule basicGetRuleParent() {
		return ruleParent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setRuleParent(Rule newRuleParent) {
		Rule oldRuleParent = ruleParent;
		ruleParent = newRuleParent;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT, oldRuleParent, ruleParent));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT:
				if (resolve) return getRuleParent();
				return basicGetRuleParent();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT:
				setRuleParent((Rule)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT:
				setRuleParent((Rule)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Nxtmodel2Package.RULE_ANNOTATION__RULE_PARENT:
				return ruleParent != null;
		}
		return super.eIsSet(featureID);
	}

} //RuleAnnotationImpl
